package com.example.leetcode.niuke;

import java.util.Scanner;

public class Niuke6 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        if (s.length() == 1) {
            System.out.println(-1);
        }
        int start = -1;
        int end = -1;
        int r = -1;
        for (int i= 0;i <s.length();i++) {
            if (s.charAt(i) - '0' >= 0 && s.charAt(i) - '0' <=9) {
                if (start == -1) {
                    start = i;
                    end = i;
                }else {
                    end = i;
                }
            }else {
                if (start != -1) {
                    r = Math.max(end -start + 1 ,r);
                    start = -1;
                    end = -1;
                }
            }
        }
        if (r == s.length()) {
            System.out.println(-1);
        }
        System.out.println(r + 1);
    }
}
